import request from "../http/http"
const isLoggedIn = localStorage.getItem('token');

export const addCar = (category) => {
    console.log(category,'调用了添加接口')
    return request.post('/admin/addcar', category,{
        headers:{
            Token:isLoggedIn
        }
    });
};



//获取车辆信息
export const getCarList = (count,data) => {
    console.log(count,"count")
    console.log(data.startDate,"data")
    return request.get('/admin/getcars', {
        params:{
            page:count,
            size:20,
            endDate:data.endDate,
            startDate:data.startDate
        },
        headers:{
            Token:isLoggedIn
        }
    });
};

// export const loginInfo = (key) => {
//     return request.get('/admin/user/info', {
//         headers:{
//             Token: key
//         }
//     });
// };

// 删除车辆
export const deleteCar = (carId) => {
    return request.delete(`/admin/deletecar/${carId}`, {
        headers: {
            Token: isLoggedIn
        }
    });
};

// 修改车辆信息
export const putCar = (data) => {
    console.log(data,'调用了修改接口')
    return request.put('/admin/updatecar', data,{
        headers:{
            Token:isLoggedIn
        }
    });
};